Embedded Programming



Traffic Light and Pedestrian Crossing System


Tinkercad

Tinkercad

Circuit

circuit


Program

#define helps to give a certain name to a constant value
For example, #define ledG 6, ledG is the name and 6 is the pin number.

#define

void setup() is a function that only run once.
Inside the void, it initialise the variables, pin mode [ pinMode(name,OUTPUT/INPUT) ] and libraries.
For example, in order to set ledG and output we write: pinMode(ledG, OUTPUT)

void setup()

void loop() is a function that will cause the program to be execute repeatedly.
if statement will check if pushbutton is pressed, if = 0 than it is pressed , if = 1 than is not pressed.
the statement inside the if will only execute when pushbutton (pb) is 0 (pressed)

void loop()

Video of the Traffic Light and Pedestrian Crossing System


All files/program

Click here to download files.